import Vue from 'vue'
import Router from 'vue-router'
const { ipcRenderer } = require('electron')

// in development-env not use lazy-loading, because lazy-loading too many pages will cause webpack hot update too slow. so only in production use lazy-loading;
// detail: https://panjiachen.github.io/vue-element-admin-site/#/lazy-loading

Vue.use(Router)

/* Layout */
import Layout from '../views/layout/Layout'

/**
* hidden: true                   if `hidden:true` will not show in the sidebar(default is false)
* alwaysShow: true               if set true, will always show the root menu, whatever its child routes length
*                                if not set alwaysShow, only more than one route under the children
*                                it will becomes nested mode, otherwise not show the root menu
* redirect: noredirect           if `redirect:noredirect` will no redirct in the breadcrumb
* name:'router-name'             the name is used by <keep-alive> (must set!!!)
* meta : {
    title: 'title'               the name show in submenu and breadcrumb (recommend set)
    icon: 'svg-name'             the icon show in the sidebar,
  }
**/
export const constantRouterMap = [
  { path: '/login', component: () => import('@/views/login/index'), hidden: true },
  { path: '/404', component: () => import('@/views/404'), hidden: true },

  {
    path: '/',
    component: Layout,
    redirect: '/home',
    name: '首页',
    hidden: true,
    children: [{
      path: 'home',
      component: () => import('@/views/dashboard/index'),
      meta: { title: '首页' }
    }]
  },

  {
    path: '/example',
    component: Layout,
    redirect: '/example/video',
    name: '图像采集',
    meta: { title: '图像采集', icon: 'icon-Example' },
    children: [
      {
        path: 'video',
        name: 'video',
        component: () => import('@/views/video/video'),
        meta: { title: '图像采集', icon: 'icon-video' }
      },
      // {
      //   path: 'tree',
      //   name: 'Tree',
      //   component: () => import('@/views/tree/index'),
      //   meta: { title: 'Tree', icon: 'tree' }
      // }
    ]
  },

  {
    path: '/opencv',
    component: Layout,
    redirect: '/opencv/HPV',
    name: '图片处理',
    meta: { title: '图片处理', icon: 'icon-Example' },
    children: [
      {
        path: 'HPV',
        name: 'HPV分析',
        component: () => import('@/views/opencv/opencv'),
        meta: { title: 'HPV', icon: 'icon-HPV' }
      },
      {
        path: 'STD',
        name: 'STD分析',
        component: () => import('@/views/opencv/STD'),
        meta: { title: 'STD', icon: 'icon-STD' }
      },
      // {
      //   path: 'UTI',
      //   name: 'UTI分析',
      //   component: () => import('@/views/opencv/UTI'),
      //   meta: { title: 'UTI', icon: 'icon-STD' }
      // },
      // {
      //   path: 'UTI2',
      //   name: 'UTI2分析',
      //   component: () => import('@/views/opencv/UTI2'),
      //   meta: { title: 'UTI2', icon: 'icon-STD' }
      // },
      // {
      //   path: 'ID',
      //   name: 'ID分析',
      //   component: () => import('@/views/opencv/ID'),
      //   meta: { title: 'ID', icon: 'icon-STD' }
      // },
      // {
      //   path: 'RP3',
      //   name: 'RP3分析',
      //   component: () => import('@/views/opencv/RP3'),
      //   meta: { title: 'RP3', icon: 'icon-STD' }
      // },
      // {
      //   path: 'RP7',
      //   name: 'RP7分析',
      //   component: () => import('@/views/opencv/RP7'),
      //   meta: { title: 'RP7', icon: 'icon-STD' }
      // },
      // {
      //   path: 'RP11',
      //   name: 'RP11分析',
      //   component: () => import('@/views/opencv/RP11'),
      //   meta: { title: 'RP11', icon: 'icon-STD' }
      // },
      // {
      //   path: 'HP',
      //   name: 'HP分析',
      //   component: () => import('@/views/opencv/HP'),
      //   meta: { title: 'HP', icon: 'icon-STD' }
      // },
    ]
  },

  // {
  //   path: '/form',
  //   component: Layout,
  //   children: [
  //     {
  //       path: 'index',
  //       name: 'Form',
  //       component: () => import('@/views/form/index'),
  //       meta: { title: 'Form', icon: 'form' }
  //     }
  //   ]
  // },

  { path: '*', redirect: '/404', hidden: true }
]

export default new Router({
  // mode: 'history', //后端支持可开
  scrollBehavior: () => ({ y: 0 }),
  routes: constantRouterMap
})

